package com.llyb.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class HelloController {

    @Resource
    private ChatModel chatModelQwen;

    @GetMapping("/langchain4j/hello")
    public String hello(@RequestParam(value = "prompt",defaultValue = "你是谁") String prompt){
        String result = chatModelQwen.chat(prompt);
        System.out.println(result);
        return result;
    }
}
